import http from "@/http/index";
import useMenu from "@/hooks/useMenu";




export default class UserApi {
  /**
   * @description 获取指定用户菜单数据
   * @param userId 
   * @returns 
   */
  static getUserMenuData(userId:string):Promise<HttpType.ResponseData<{
    userId:string;
    menuList:Array<UserType.MenuInfo>;
    roleList:Array<UserType.RoleInfo>;
  }>>{
    return http.get("/User/getUserRoleMenu",{
      params:{
        userId
      }
    })
  }

  /**
   * @description 获取所有用户数据
   * @param pageNum 
   * @param pageSize 
   * @returns 
   */
  static getAllUserList(pageNum:number,pageSize:number):Promise<HttpType.ResponseData<{
    total:number;
    list:Array<UserType.User>
  }>>  {
    return http.get("/User/getAllUserData",{
      params:{
        pageNum,
        pageSize
      }
    });
  }

    static getUserInfoById(userId:string):Promise<HttpType.ResponseData<UserType.UserInfo>>  {
    return http.get(`/User/getUserByUserId/${userId}`);
  }

    static saveUserInfoByUserId(data:Partial<UserType.UserInfo>):Promise<HttpType.ResponseData<string>>  {
    return http.post("/User/updateUser",data);
  }
}